
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
// *********************************** 路径配置新增 start  
import { resolve } from 'path'
 
const pathResolve = (dir: string): any => {
  return resolve(__dirname, ".", dir)
}
 
const alias: Record<string, string> = {
  '@': pathResolve("src")
}
// https://vitejs.dev/config/
export default defineConfig({
  base:'./',
  server:{
    port:5174,
    proxy:{
      '/agvapi': {
        target: 'http://192.168.12.20:4333',	//实际请求地址
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/agvapi/, '')
      },
    }
  },
  plugins: [
    vue(),
    AutoImport({
      imports: [
        // 需要自动导入的插件，自定义导入的API
        'vue',
        'vue-router',
        'pinia',
        
      ]
    })
  ],
  resolve: {  // ****************** 路径配置新增
    alias     // ****************** 路径配置新增
  }           // ****************** 路径配置新增
})